home *** CD-ROM | disk | FTP | other *** search
- unit WebBrowserForm;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- OleCtrls, SHDocVw, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Browser: TWebBrowser;
- procedure FormCreate(Sender: TObject);
- procedure BrowserBeforeNavigate2(Sender: TObject;
- const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
- Headers: OleVariant; var Cancel: WordBool);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Browser.Navigate('http://localhost/scripts/WebTest.exe')
- end;
-
- procedure TForm1.BrowserBeforeNavigate2(Sender: TObject;
- const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
- Headers: OleVariant; var Cancel: WordBool);
- var
- Tmp: OleVariant;
- S: String;
- P: Pointer;
- begin
- Tmp := OleVariant(TVarData(PostData).VPointer^);
- if VarIsArray(Tmp) then
- begin
- SetLength(S, VarArrayHighBound(Tmp, 1) - VarArrayLowBound(Tmp, 1) + 1);
- P := VarArrayLock(Tmp);
- try
- Move(P^, S[1], Length(S));
- Caption := S
- finally
- VarArrayUnlock(Tmp)
- end
- end
- end;
-
- end.
-